//
//  InformationCommentCell.swift
//  ModernFoodWebsite
//
//  Created by apple on 16/5/30.
//  Copyright © 2016年 Lonnie. All rights reserved.
//

import UIKit

class InformationCommentCell: UITableViewCell {
    let iconView = UIImageView()
    let nicknameLabel = UILabel()
    let timeLabel = UILabel()
    let contentLabel = UILabel()
    let upButton = UIButton()
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        contentView.addSubviews([iconView,nicknameLabel,timeLabel,contentLabel,upButton])
        
        //头像
        iconView.snp_makeConstraints { (make) in
            make.leading.equalTo(contentView).offset(14)
            make.top.equalTo(contentView).offset(9.5)
            make.width.equalTo(45)
            make.height.equalTo(45)
            
        }
        iconView.layer.cornerRadius = 22.5
        iconView.layer.masksToBounds = true
        
        //昵称
        nicknameLabel.textColor = Style.themeColor1
        nicknameLabel.font = UIFont.systemFontOfSize(14)
        nicknameLabel.snp_makeConstraints { (make) in
            make.top.equalTo(iconView).offset(6.5)
            make.leading.equalTo(iconView.snp_trailing).offset(14)
            
        }
        //时间
        timeLabel.textColor = Style.textColor1
        timeLabel.font = UIFont.systemFontOfSize(11)
        timeLabel.snp_makeConstraints{ make in
            make.leading.equalTo(nicknameLabel)
            make.top.equalTo(nicknameLabel.snp_bottom).offset(7)
        }
        
        
        
        //内容
        contentLabel.textColor = Style.textColor1
        contentLabel.font = UIFont.systemFontOfSize(15)
        contentLabel.numberOfLines = 0
        contentLabel.snp_makeConstraints { (make) in
            make.width.equalTo(contentView).offset(-28)
            make.centerX.equalTo(contentView)
            make.top.equalTo(contentView.snp_top).offset(64)
            make.bottom.equalTo(contentView.snp_bottom).offset(-10)
        }
        
        
        //点赞
        upButton.setImage(UIImage(named: "icon_up_normal"), forState: .Normal)
        upButton.snp_makeConstraints { (make) in
            make.trailing.equalTo(contentView).offset(-20)
            make.top.equalTo(contentView).offset(20)
        }
       
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
